<?php
include("mysql.php");
if(isset($_GET['name']) and isset($_GET['pwd']))
{
$name=$_GET['name'];
$pwd=sha1(htmlentities($_GET['pwd']));
$check="SELECT * FROM  `user` WHERE  `name` =  '$name'";
$ret=mysql_query($check);
$row=mysql_fetch_array($ret);
//echo $row['pwd'];
//if($ret)
if($row['pwd'])
{
    echo'你已经注册过，请勿重复注册';
    exit;
}

$sql="alter table `user` AUTO_INCREMENT=1";
mysql_query($sql);  //序列号自动归0

$mysql="INSERT INTO `user` (`id`, `name`, `pwd`, `time`, `login_time`, `s_time`, `sta`) VALUES (NULL, '$name', '$pwd', '', NOW(), '', '0');";
$ret=mysql_query($mysql);

if($ret){
    echo '注册成功';
    exit;
}
else{
    echo '注册失败';
    exit;
}
}
else{
    echo "<br>请传入账户密码参数";
}
?>